package com.example.goods_admin.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class DataListener<T> extends AnalysisEventListener<T> {


    private final List<T> rows = Collections.synchronizedList(new ArrayList<>());

    @Override
    public void invoke(T t, AnalysisContext analysisContext) {
        rows.add(t);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
    }

    public List<T> getRows() {
        return rows;
    }

}
